package study.domain.attachment;

public enum AttachmentType {

	ORIGINAL(0, 0, ""),
	IMAGE_SMALL(150, 150, "_s"),
	IMAGE_MEDIUM(300, 300, "_m"),
	IMAGE_LARGE(1024, 500, "_l");

	private int maxWidth;

	private int maxHeight;

	private String postfix;

	AttachmentType(int maxWidth, int maxHeight, String postfix) {
		this.maxWidth = maxWidth;
		this.maxHeight = maxHeight;
		this.postfix = postfix;
	}

	public int getMaxWidth() {
		return maxWidth;
	}

	public int getMaxHeight() {
		return maxHeight;
	}

	public String getPostfix() {
		return postfix;
	}

	public String getPostfix(int width, int height) {
		return (this != ORIGINAL && (width > maxWidth || height > maxHeight)) ? postfix : "";
	}
}
